package cn.com.dcsgo.feign.fallback;

import cn.com.dcsgo.dto.MemberAddressDTO;
import cn.com.dcsgo.dto.MemberInfoDTO;
import cn.com.dcsgo.feign.MemberFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * MemberFeignClient 兜底回调
 *
 * @author Dcsgo
 * @since 2025/11/6 13:51
 */
@Slf4j
@Component
public class MemberFeignClientFallback implements MemberFeignClient {
    @Override
    public List<MemberInfoDTO> findMemberNickNameAndPicByOpenIds(Set<String> openIds) {
        log.error("RPC错误：获取会员昵称和头像的远程调用走了兜底回调");
        return new ArrayList<>(0);
    }

    @Override
    public MemberAddressDTO getMemberDefaultAddress(String openid) {
        log.error("RPC错误：getMemberDefaultAddress 的远程调用走了兜底回调");
        MemberAddressDTO memberAddressDTO = new MemberAddressDTO();
        memberAddressDTO.setAddr("该地址为获取默认地址失败时返回的地址");
        return memberAddressDTO;
    }
}
